5 of 14
Using Client-Scoped Variables for Application Scalability
Since session variables can only be stored in server RAM and
since application and server variables aren't user-specific, we
can't use those scopes to maintain client state in a load-balanced
environment. We must therefore turn to client-scoped variables to
solve this problem. More specifically, these client-scoped variables
need to be stored in a specially designated database as opposed to
the server registry (the default option for client variables). In
this article I'm going to provide the systematic process for
designing or converting a CF application to run on a Web server
cluster, using database-stored client-scoped variables.
Configuration Outline
There are three basic areas
you'll need to address in order to implement database-stored
client-scoped variables within your application. The three steps are
as follows:
1. Database configuration: Since all members
of your ColdFusion Web cluster can "see" your database server
cluster, this is where your client variables will be stored. You'll
create a database on your server for use as the client variable
repository (CVR).
2. CF server(s) configuration: All the
servers in your cluster will need to be configured not to store
client variables in the registry, but to use instead the database
you'll have configured in Step 1. This involves using the ColdFusion
Administrator to create an ODBC data source and the connection to
your CVR. I'll also describe in detail how to disable the
session-aware load-balancing feature within ClusterCATS.
3.
Application design/conversion: If you'll be developing a new
application, this step will help you design your application to
support server clustering right from the start. If you have an
existing application, this step will describe the changes that are
required to make your application "clustering friendly."
If your application is already running in some form and you're
tasked with planning or implementing a conversion, I would strongly
recommend that you verify that all current features of your
application are in working order prior to beginning this process. If
you know everything worked before you started, you'll have a much
easier time determining what problems may have surfaced as a result
of the conversion process.
5 of 14